package dongshi.daddy.prototype.deepcopy;

import java.util.ArrayList;

public class Thing1 implements Cloneable {
    private ArrayList<String> list = new ArrayList<String>();

    @Override
    public Thing1 clone() {
        Thing1 thing = null;
        try {
            thing = (Thing1) super.clone();
            thing.list = (ArrayList) this.list.clone();
        } catch (CloneNotSupportedException e) {
            e.printStackTrace();
            System.out.println("克隆失败");
        }
        return thing;
    }

    public void setValue(String value) {
        this.list.add(value);
    }

    public ArrayList getValue() {
        return this.list;
    }
}